<?php

/**
 * sfGuardUser form.
 *
 * @package    SistemaWebUnlSenescyt
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrinePluginFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class sfGuardUserForm extends PluginsfGuardUserForm {

    protected static $subjects = array(0 => 'M',
        1 => 'F');

    public function configure() {
        $this->useFields(array('dni', 'first_name', 'last_name', 'email_address', 'sexo', 'direccion', 'telefono', 'telefonoMovil', 'username',  'is_active', 'groups_list', 'permissions_list'));

        $this->widgetSchema ['dni'] = new sfWidgetFormInputText();
        $this->widgetSchema ['first_name'] = new sfWidgetFormInputText();
        $this->widgetSchema ['last_name'] = new sfWidgetFormInputText();
        $this->widgetSchema ['email_address'] = new sfWidgetFormInputText();
        $this->widgetSchema ['sexo'] = new sfWidgetFormSelect(array('choices' => self::$subjects));
        $this->widgetSchema ['direccion'] = new sfWidgetFormInputText();
        $this->widgetSchema ['telefono'] = new sfWidgetFormInputText();
        $this->widgetSchema ['telefonoMovil'] = new sfWidgetFormInputText();
        $this->widgetSchema ['username'] = new sfWidgetFormInputText();
        
        $this->widgetSchema ['is_active'] = new sfWidgetFormInputCheckbox();
        $this->widgetSchema ['groups_list'] = new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardGroup'));
        $this->widgetSchema ['permissions_list'] = new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardPermission'));



        $this->validatorSchema['dni'] = new sfValidatorInteger();
        $this->validatorSchema['first_name'] = new sfValidatorString(array('max_length' => 25));
        $this->validatorSchema['last_name'] = new sfValidatorString(array('max_length' => 25));
        $this->validatorSchema['email_address'] = new sfValidatorString(array('max_length' => 255));
        $this->validatorSchema['sexo'] = new sfValidatorChoice(array('choices' => array_keys(self::$subjects)));
        $this->validatorSchema['direccion'] = new sfValidatorString(array('max_length' => 30));
        $this->validatorSchema['telefono'] = new sfValidatorInteger();
        $this->validatorSchema['telefonoMovil'] = new sfValidatorInteger();
        $this->validatorSchema['username'] = new sfValidatorString(array('max_length' => 128));
        $this->validatorSchema['password'] = new sfValidatorString(array('max_length' => 128, 'required' => false));
        $this->validatorSchema['is_active'] = new sfValidatorBoolean(array('required' => false));
        $this->validatorSchema['groups_list'] = new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardGroup', 'required' => false));
        $this->validatorSchema['permissions_list'] = new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardPermission', 'required' => false));

        $this->widgetSchema->setLabels(array(
            'dni' => 'DNI',
            'first_name' => 'Nombres',
            'last_name' => 'Apellidos',
            'email_address' => 'Correo<br /> Electrónico',
            'sexo' => 'Género',
            'direccion' => 'Dirección<br />Domiciliaria',
            'telefono' => 'Teléfono',
            'telefonoMovil' => 'Celular',
            'username' => 'Nombre de Usuario',
            'password' => 'Contraseña',
            'is_active' => 'Esta Activo',
            'group_list' => 'Lista de Grupo',
            'permissions_list' => 'Lista de Permisos',
        ));

        
        //$this->widgetSchema->setNameFormat('sfguarduser[%s]');
    }

}
